package org.foreveross.que.vo;

import java.util.Date;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;

import org.foreveross.que.entity.TopicEntity;

public class TopicVo {
	
	private String id;

	private Date createTime;

	private String createAccount;
	
	private String createUrole;

	private Integer isStickie;

	private Date lastTime;

	private String mid;

	private Integer browseCount;

	private Integer replyCount;

	private String replyAccount;
	
	private String replyRole;

	private String replyInfo;

	private String replyName;

	private Integer state;
	
	private String title;

	private String subjectInfo;
	
	private String sysType;
	
	private PageData pageData = new PageData();

	private String createUname;
	
	private String replyId;
	

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}



	public Integer getIsStickie() {
		return isStickie;
	}

	public void setIsStickie(Integer isStickie) {
		this.isStickie = isStickie;
	}

	public Date getLastTime() {
		return lastTime;
	}

	public void setLastTime(Date lastTime) {
		this.lastTime = lastTime;
	}

	public String getMid() {
		return mid;
	}

	public void setMid(String mid) {
		this.mid = mid;
	}

	public Integer getReplyCount() {
		return replyCount;
	}

	public void setReplyCount(Integer replyCount) {
		this.replyCount = replyCount;
	}
	
	public String getReplyRole() {
		return replyRole;
	}

	public void setReplyRole(String replyRole) {
		this.replyRole = replyRole;
	}

	public String getReplyInfo() {
		return replyInfo;
	}

	public void setReplyInfo(String replyInfo) {
		this.replyInfo = replyInfo;
	}

	public String getReplyName() {
		return replyName;
	}

	public void setReplyName(String replyName) {
		this.replyName = replyName;
	}

	public Integer getState() {
		return state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	public String getSubjectInfo() {
		return subjectInfo;
	}

	public void setSubjectInfo(String subjectInfo) {
		this.subjectInfo = StringUtils.trim(subjectInfo);
	}

	public String getSysType() {
		return sysType;
	}

	public void setSysType(String sysType) {
		this.sysType = StringUtils.trim(sysType);
	}
	
	
	
	public Integer getBrowseCount() {
		return browseCount;
	}

	public void setBrowseCount(Integer browseCount) {
		this.browseCount = browseCount;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = StringUtils.trim(title);
	}
	
	

	public String getCreateAccount() {
		return createAccount;
	}

	public void setCreateAccount(String createAccount) {
		this.createAccount = createAccount;
	}

	public String getReplyAccount() {
		return replyAccount;
	}

	public void setReplyAccount(String replyAccount) {
		this.replyAccount = replyAccount;
	}
	
	
public String getCreateUname() {
		return createUname;
	}

	public void setCreateUname(String createUname) {
		this.createUname = createUname;
	}
	
	

public String getCreateUrole() {
		return createUrole;
	}

	public void setCreateUrole(String createUrole) {
		this.createUrole = createUrole;
	}

	
	
/**
 * 加载分页显示需要的信息
 * @param topic
 * @throws Exception
 */
	public void load(TopicEntity topic) throws Exception{
		//BeanUtils.copyProperties(this, topic);
		this.browseCount = topic.getBrowseCount();
		this.createAccount = topic.getCreateAccount();
		this.createTime = topic.getCreateTime();
		this.id = topic.getId();
		this.isStickie = topic.getIsStickie();
		this.lastTime = topic.getLastTime();
		this.mid = topic.getMid();
//		this.name = topic.getName();
		this.replyAccount = topic.getReplyAccount();
		this.replyCount = topic.getReplyCount();
		this.sysType = topic.getSysType();
		this.replyInfo = topic.getReplyInfo();
		this.replyName = topic.getReplyName();
		this.replyId = topic.getReplyId();
//		this.state = topic.getState();
		//this.subjectInfo = topic.getSubjectInfo();//该字段过于庞大就不于异步显示了。
//		this.sysType = topic.getSysType();
		this.title = topic.getTitle();
		
	}
	
	public void loadSayTopic(TopicEntity topic) throws Exception{
		this.load(topic);
		this.subjectInfo = topic.getSubjectInfo();
		this.replyRole = topic.getReplyRole();
		this.createUrole = topic.getCreateUrole();
		
		
	}
	
	public TopicEntity toEntity() throws Exception{
		TopicEntity entity = new TopicEntity();
//		entity.setTitle(this.getTitle());
//		entity.setSysType(sysType);
//		entity.setSubjectInfo(subjectInfo);
		BeanUtils.copyProperties(entity, this);
		return entity;
	}
	
	public PageData getPageData() {
		return pageData;
	}



	public void setPageData(PageData pageData) {
		this.pageData = pageData;
	}
	
}
